# RegisterPage.py
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class RegisterPage:
    def __init__(self, driver):
        self.driver = driver
        self.url = 'http://your-ecommerce-app/register'
        self.username_input = (By.ID, 'username')
        self.password_input = (By.ID, 'password')
        self.confirm_password_input = (By.ID, 'confirm-password')
        self.email_input = (By.ID, 'email')
        self.register_button = (By.ID, 'register-button')
        self.error_message = (By.ID, 'error-message')
        self.success_message = (By.ID, 'success-message')

    # 导航
    def navigate(self):
        self.driver.get(self.url)

    # 用户名输入
    def enter_username(self, username):
        WebDriverWait(self.driver, 10).until(EC.presence_of_element_located(self.username_input)).send_keys(username)

    # 密码输入
    def enter_password(self, password):
        WebDriverWait(self.driver, 10).until(EC.presence_of_element_located(self.password_input)).send_keys(password)

  